﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Admin/MasterPage.master"
    CodeFile="AddArticle.aspx.cs" Inherits="Admin_AddArticle" %>

<%@ Register Assembly="FredCK.FCKeditorV2" Namespace="FredCK.FCKeditorV2" TagPrefix="FCKeditorV2" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="Server">
<style type="text/css">
    .WindowsStyle .ajax__combobox_itemlist
    {
    	position:absolute !important;  
        top: 145px !important;  
        left: 25px !important;  
        width: 150px !important;  
    }
</style>
    <script type="text/javascript">
function checkLength(con)
{
if(con.value.length >= 255)
{
return false;
}
else
{
document.getElementById('ctl00_MainContent_lblChars').innerHTML = 'осталось символов '+(254 - con.value.length)  ;return true;
}
}
function setRemaining()
{
document.getElementById('ctl00_MainContent_lblChars').innerHTML = 'осталось символов '+(255 - document.getElementById('ctl00_MainContent_txtSubTitle').value.length);
if (document.getElementById('ctl00_MainContent_txtSubTitle').value.length > 255)
{
document.getElementById('ctl00_MainContent_txtSubTitle').value = document.getElementById('ctl00_MainContent_txtSubTitle').value.substring(0,255);
}
}
    </script>

   
    <asp:UpdatePanel runat="server" ID="updMain">
        <ContentTemplate>
        <h1 runat="server" id="lblTitle"></h1>
            <asp:Panel runat="server" ID="pnlNews">
                <h1>
                    Раздел статьи</h1>
                <asp:DropDownList runat="server" ID="ddlCategories" DataTextField="cTitle" DataValueField="catID"
                    OnSelectedIndexChanged="ddlCategories_SelectedIndexChanged" AutoPostBack="true">
                </asp:DropDownList>
            </asp:Panel>
            <asp:Panel runat="server" ID="pnlMedCenters" Visible="false">
                <br />
                <img src="images/Delimiter.png" border="0" alt="">
                <h1>
                    Категории раздела</h1>
                <asp:DropDownList runat="server" ID="ddlMedCenters" DataTextField="cTitle" DataValueField="catID"
                    OnSelectedIndexChanged="ddlMedCenters_SelectedIndexChanged" AutoPostBack="false">
                </asp:DropDownList>
            </asp:Panel>
            <asp:Panel runat="server" ID="pnlWiki" Visible="false">
                <br />
                <img src="images/Delimiter.png" border="0" alt="">
                <h1>
                    Категория раздела</h1>
                <asp:DropDownList runat="server" ID="ddlWiki" DataTextField="cTitle" DataValueField="catID"
                    OnSelectedIndexChanged="ddlWiki_SelectedIndexChanged" AutoPostBack="true">
                </asp:DropDownList>
                <h1>
                    Подкатегория</h1>
                <asp:DropDownList runat="server" ID="ddlWikiSubCat" DataTextField="cTitle" DataValueField="catID"
                    AutoPostBack="false">
                </asp:DropDownList>
            </asp:Panel>
            <asp:Panel runat="server" ID="pnlAddArticle">
                <br />
                <img src="images/Delimiter.png" border="0" alt="">
                <h1>
                    Статья</h1>
                <asp:CheckBox runat="server" ID="chkShowArticle" Checked="true" Text="Показывать на сайте" />
                <br />
                <div>
                <span class="RegularBold">Page keywords</span><br />
                <asp:TextBox ID="txtPageKeywords" runat="server" Width="480px"></asp:TextBox><br />
                <span class="RegularBold">Название страницы</span><br />
                <asp:TextBox ID="txtUrl" runat="server" Width="480px"></asp:TextBox><br />
                <asp:RequiredFieldValidator ID="valName" Font-Size="Smaller" runat="server" Display="Dynamic"
                                                ErrorMessage="поле необходимое для заполнения" ControlToValidate="txtBrowserTitle" ValidationGroup="Article"></asp:RequiredFieldValidator>
                </div>
                <span class="RegularBold">Browser Title</span><br />
                <asp:TextBox ID="txtBrowserTitle" runat="server" Width="480px"></asp:TextBox><br />
                <span class="RegularBold">Название статьи</span><br />
                <div>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" Font-Size="Smaller" runat="server" Display="Dynamic"
                                                ErrorMessage="поле необходимое для заполнения" ControlToValidate="txtTitle" ValidationGroup="Article"></asp:RequiredFieldValidator>
                </div>
                <asp:TextBox ID="txtTitle" runat="server" Width="480px"></asp:TextBox><br />
                <br />
                <asp:Panel runat="server" ID="pnlPublicationDate">
                    <span class="RegularBold">Дата публикации:</span><br />
                    <asp:TextBox ID="txtPublishDate" runat="server" Width="110px"></asp:TextBox><br />
                    <span class="RegularBold">Время публикации:</span><br />
                    <asp:TextBox ID="txtPublishTime" runat="server" Width="110px"></asp:TextBox><br />
                    <asp:CheckBox runat="server" ID="chkShowDateDime" Checked="true" Text="Показывать время и дату" />
                </asp:Panel>
                <span class="RegularBold">Краткое описание статьи</span><br />
                <%--<asp:Label runat="server" ID="lblChars" Text="осталось символов 255"></asp:Label><br />--%>
                <FCKeditorV2:FCKeditor runat="server" ID="txtSubTitle" BasePath="~/fckeditor/" Width="651px"
                    EnableViewState="true" Height="228px" ToolbarSet="ArticleBasic">
                </FCKeditorV2:FCKeditor>
                <%--<asp:TextBox runat="server" ID="txtSubTitle" onkeypress="return checkLength(this);"
                    onkeyup="setRemaining();" Width="480px" Height="110px" MaxLength="255" TextMode="MultiLine"></asp:TextBox>--%>
                <br />
                <span class="RegularBold">Статья</span>
                <div>
                <asp:RequiredFieldValidator ID="RequiredFieldValidator2" Font-Size="Smaller" runat="server" Display="Dynamic"
                                                ErrorMessage="поле необходимое для заполнения" ControlToValidate="edArticle" ValidationGroup="Article"></asp:RequiredFieldValidator>
                </div>
                <FCKeditorV2:FCKeditor runat="server" ID="edArticle" BasePath="~/fckeditor/" Width="651px"
                    EnableViewState="true" Height="228px" ToolbarSet="ArticleBasic">
                </FCKeditorV2:FCKeditor>
                <asp:UpdatePanel runat="server" ID="updTags">
                    <ContentTemplate>
                        <asp:Panel runat="server" ID="pnlTags">
                        <div>
                            <span class="RegularBold">Tag System</span><br />
                            <ajax:ComboBox runat="server" ID="cmbTags" RenderMode="Block" DropDownStyle="DropDown" AutoCompleteMode="Append"
                                CaseSensitive="true" CssClass="WindowsStyle" DataTextField="KeyName" DataValueField="KeyID" OnItemInserting="cmbTags_ItemInserting">
                            </ajax:ComboBox>
                        </div>
                            <asp:DataList runat="server" RepeatDirection="Horizontal" ID="rptTags">
                                <ItemTemplate>
                                    <asp:HiddenField runat="server" ID="hfTagID" Value='<%# Eval("KeyID")%>' />
                                    <asp:Label runat="server" Text='<%# Eval("KeyName")%>'></asp:Label>
                                    <asp:ImageButton runat="server" ID="imgDelete" CommandArgument='<%# Eval("KeyID")%>'
                                        ImageUrl="~/Admin/images/delete.png" OnClick="imgDelete_Click" />
                                </ItemTemplate>
                            </asp:DataList>
                            <br />
                            <asp:Button ID="btnAddTag" runat="server" Text="Добавить новый тег" OnClick="btnAddTag_Click" />
                        </asp:Panel>
                    </ContentTemplate>
                    <Triggers>
                        <asp:AsyncPostBackTrigger ControlID="btnAddTag" />
                    </Triggers>
                </asp:UpdatePanel>
                <asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Сохранить" ValidationGroup="Article" />
                <asp:Button ID="btnToImages" runat="server" Text="Обработка изображений" OnClick="btnToImages_Click"
                    Visible="false" />
            </asp:Panel>
            </div>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
